<template>
    <div class="electroniciindex">
        <Card class="clearfix" style="padding-bottom: 16px">
            <p slot="title">
                寻车管理
            </p>
            <Form label-position="left" :label-width="72">
                <Row :gutter="24">
                    <i-col span="6">
                        <FormItem label="用户名称：">
                            <Input v-model="search.userName" clearable placeholder="请输入用户名称"/>
                        </FormItem>
                    </i-col>
                    <i-col span="6">
                        <FormItem label="企业名称：">
                            <Input v-model="search.partyName" clearable placeholder="请输入企业名称"/>
                        </FormItem>
                    </i-col>
                    <i-col span="6">
                    <FormItem label="车型信息：">
                        <Input v-model="search.model" clearable placeholder="请输人车型信息"/>
                    </FormItem>
                    </i-col>
                    <i-col span="4">
                        <FormItem label="反馈状态：">
                            <Select clearable v-model="search.feedBack">
                                <Option  :value="0" >未反馈</Option>
                                <Option  :value="1" >已反馈</Option>
                            </Select>
                        </FormItem>
                    </i-col>
                    <i-col span="2">
                        <Button type="success" @click="searchData" icon="ios-search" >搜索</Button>
                    </i-col>
                </Row>
            </Form>
            <br>
            <div>
                <list-table refs="table1" v-model="table.list"  :table-data="table.list"></list-table>
            </div>
            <Page ref="pages" :total="table.itemTotal" show-total style="float: right; margin-top: 20px" @on-change="getList"></Page>
        </Card>
    </div>
</template>

<script>
    import listTable from './components/listTable.vue'
    import ajax from '../../../libs/axios.js'
    import moment from "moment";
    export default {
        name: 'personalindex',
        components: {
            listTable
        },
        data () {
            return {
                search:{
                    userName:"",          // 用户名称
                    partyName:"",         // 企业名称
                    model:"",             // 车型信息
                    feedBack:"",          // 反馈状态

                },
                table:{
                   list:[],               // 表格数据
                   itemTotal:1,           // 数据条数
                },
            }
        },
        mounted () {
            this.init()
        },
        activated() {
            this.init()
        },
        methods: {
            // 数据初始化
            init () {
                this.getList(1)
            },
            // 搜索
            searchData () {
                if (this.search.feedBack == undefined){
                    this.search.feedBack="";
                }
                this.getList(1)
            },
            // 获取列表
            getList (page) {
                let url = 'adminlogin/carsearch/selectInfos.html'
                let data = {
                    pageSize: 10,
                    pageNum: page,
                    userName:this.search.userName,         // 用户名称
                    partyName:this.search.partyName,       // 企业名称
                    model:this.search.model,               // 车型信息
                    feedBack:this.search.feedBack,         // 反馈状态
                }
                ajax.formRes(url, data).then(res => {
                    this.table.list = res.data;
                    this.table.itemTotal = res.count;
                }).catch(err => {
                    console.log('有错误信息')
                })
            },
        },
    }
</script>


<style lang="less">
    @import "../../../styles/common.less";
    @import "../../../styles/table.less";
    .electroniciindex .create .ivu-date-picker .ivu-select-dropdown{
        left: inherit !important;
    }
</style>

